<!--
 * @Descripttion:
 * @version:
 * @Author: cxguo
 * @Date: 2020-07-28 09:57:14
 * @LastEditors: cxguo
 * @LastEditTime: 2020-11-07 13:37:37
-->
<template>
  <div>
    <el-popover
      placement="top"
      width="800"
      trigger="click"
      @hide="onHide"
    >
      <stock
        ref="stock"
        :unit-data="unitData"
        :store-data="storeData"
        @on-init-success="onInitSuccess"
      >
        <i slot="title" />
      </stock>
      <el-button slot="reference" type="primary" plain>点击输入</el-button>
    </el-popover>
  </div>
</template>

<script>
import stock from '@/views/bsd/goods/detail/components/stock.vue'

export default {
  components: { stock },
  props: {
    value: {
      type: Array,
      default: () => { return [] }
    },
    unitData: {
      type: Array,
      default: () => { return [] }
    },
    storeData: {
      type: Array,
      default: () => { return [] }
    }

  },
  methods: {
    onHide() {
      const stockComp = this.$refs.stock
      const stockData = stockComp.getStockData()
      this.$emit('input', stockData)
    },
    onInitSuccess(stockData) {
      this.$emit('input', stockData)
    }
  }
}
</script>

<style>

</style>
